package cur.nature.starter.common.config;

import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ApiDocAdminConfig {

//    @Bean
//    public OpenAPI springShopOpenAPI() {
//        return new OpenAPI()
//                .info(new Info().title("SpringShop API")
//                        .description("Spring shop sample application")
//                        .version("v0.0.1")
//                        .license(new License().name("Apache 2.0").url("http://springdoc.org")))
//                        .externalDocs(new ExternalDocumentation()
//                        .description("SpringShop Wiki Documentation")
//                        .url("https://springshop.wiki.github.org/docs"));
//    }

    @Bean
    public GroupedOpenApi siteApi() {
        return GroupedOpenApi.builder()
                .group("系统管理接口")
                .pathsToMatch("/admin/v1/api/**")
                .build();
    }

    @Bean
    public GroupedOpenApi domainApi() {
        return GroupedOpenApi.builder()
                .group("主页管理接口")
                .pathsToMatch("/domain/v1/api/**")
                .build();
    }

    @Bean
    public GroupedOpenApi managerApi() {
        return GroupedOpenApi.builder()
                .group("通用管理接口")
                .pathsToMatch("/manager/v1/api/**")
                .build();
    }

    @Bean
    public GroupedOpenApi componentApi() {
        return GroupedOpenApi.builder()
                .group("系统组件接口")
                .pathsToMatch("/component/**")
                .build();
    }
}
